Left Termination of the query pattern rem_in_3(g, g, a) w.r.t. the given Prolog program could successfully be proven:



Prolog
  ↳ PrologToPiTRSProof

Clauses:

rem(X, Y, R) :- ','(notZero(Y), ','(sub(X, Y, Z), rem(Z, Y, R))).
rem(X, Y, X) :- ','(notZero(Y), geq(X, Y)).
sub(s(X), s(Y), Z) :- sub(X, Y, Z).
sub(X, 0, X).
notZero(s(X)).
geq(s(X), s(Y)) :- geq(X, Y).
geq(X, 0).

Queries:

rem(g,g,a).

We use the technique of [30].Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

rem_in(X, Y, X) → U4(X, Y, notZero_in(Y))
notZero_in(s(X)) → notZero_out(s(X))
U4(X, Y, notZero_out(Y)) → U5(X, Y, geq_in(X, Y))
geq_in(X, 0) → geq_out(X, 0)
geq_in(s(X), s(Y)) → U7(X, Y, geq_in(X, Y))
U7(X, Y, geq_out(X, Y)) → geq_out(s(X), s(Y))
U5(X, Y, geq_out(X, Y)) → rem_out(X, Y, X)
rem_in(X, Y, R) → U1(X, Y, R, notZero_in(Y))
U1(X, Y, R, notZero_out(Y)) → U2(X, Y, R, sub_in(X, Y, Z))
sub_in(X, 0, X) → sub_out(X, 0, X)
sub_in(s(X), s(Y), Z) → U6(X, Y, Z, sub_in(X, Y, Z))
U6(X, Y, Z, sub_out(X, Y, Z)) → sub_out(s(X), s(Y), Z)
U2(X, Y, R, sub_out(X, Y, Z)) → U3(X, Y, R, rem_in(Z, Y, R))
U3(X, Y, R, rem_out(Z, Y, R)) → rem_out(X, Y, R)

The argument filtering Pi contains the following mapping:
rem_in(x1, x2, x3)  =  rem_in(x1, x2)
U4(x1, x2, x3)  =  U4(x1, x2, x3)
notZero_in(x1)  =  notZero_in(x1)
s(x1)  =  s(x1)
notZero_out(x1)  =  notZero_out
U5(x1, x2, x3)  =  U5(x1, x3)
geq_in(x1, x2)  =  geq_in(x1, x2)
0  =  0
geq_out(x1, x2)  =  geq_out
U7(x1, x2, x3)  =  U7(x3)
rem_out(x1, x2, x3)  =  rem_out(x3)
U1(x1, x2, x3, x4)  =  U1(x1, x2, x4)
U2(x1, x2, x3, x4)  =  U2(x2, x4)
sub_in(x1, x2, x3)  =  sub_in(x1, x2)
sub_out(x1, x2, x3)  =  sub_out(x3)
U6(x1, x2, x3, x4)  =  U6(x4)
U3(x1, x2, x3, x4)  =  U3(x4)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog



↳ Prolog
  ↳ PrologToPiTRSProof
PiTRS
      ↳ DependencyPairsProof

Pi-finite rewrite system:
The TRS R consists of the following rules:

rem_in(X, Y, X) → U4(X, Y, notZero_in(Y))
notZero_in(s(X)) → notZero_out(s(X))
U4(X, Y, notZero_out(Y)) → U5(X, Y, geq_in(X, Y))
geq_in(X, 0) → geq_out(X, 0)
geq_in(s(X), s(Y)) → U7(X, Y, geq_in(X, Y))
U7(X, Y, geq_out(X, Y)) → geq_out(s(X), s(Y))
U5(X, Y, geq_out(X, Y)) → rem_out(X, Y, X)
rem_in(X, Y, R) → U1(X, Y, R, notZero_in(Y))
U1(X, Y, R, notZero_out(Y)) → U2(X, Y, R, sub_in(X, Y, Z))
sub_in(X, 0, X) → sub_out(X, 0, X)
sub_in(s(X), s(Y), Z) → U6(X, Y, Z, sub_in(X, Y, Z))
U6(X, Y, Z, sub_out(X, Y, Z)) → sub_out(s(X), s(Y), Z)
U2(X, Y, R, sub_out(X, Y, Z)) → U3(X, Y, R, rem_in(Z, Y, R))
U3(X, Y, R, rem_out(Z, Y, R)) → rem_out(X, Y, R)

The argument filtering Pi contains the following mapping:
rem_in(x1, x2, x3)  =  rem_in(x1, x2)
U4(x1, x2, x3)  =  U4(x1, x2, x3)
notZero_in(x1)  =  notZero_in(x1)
s(x1)  =  s(x1)
notZero_out(x1)  =  notZero_out
U5(x1, x2, x3)  =  U5(x1, x3)
geq_in(x1, x2)  =  geq_in(x1, x2)
0  =  0
geq_out(x1, x2)  =  geq_out
U7(x1, x2, x3)  =  U7(x3)
rem_out(x1, x2, x3)  =  rem_out(x3)
U1(x1, x2, x3, x4)  =  U1(x1, x2, x4)
U2(x1, x2, x3, x4)  =  U2(x2, x4)
sub_in(x1, x2, x3)  =  sub_in(x1, x2)
sub_out(x1, x2, x3)  =  sub_out(x3)
U6(x1, x2, x3, x4)  =  U6(x4)
U3(x1, x2, x3, x4)  =  U3(x4)


Using Dependency Pairs [1,30] we result in the following initial DP problem:
Pi DP problem:
The TRS P consists of the following rules:

REM_IN(X, Y, X) → U41(X, Y, notZero_in(Y))
REM_IN(X, Y, X) → NOTZERO_IN(Y)
U41(X, Y, notZero_out(Y)) → U51(X, Y, geq_in(X, Y))
U41(X, Y, notZero_out(Y)) → GEQ_IN(X, Y)
GEQ_IN(s(X), s(Y)) → U71(X, Y, geq_in(X, Y))
GEQ_IN(s(X), s(Y)) → GEQ_IN(X, Y)
REM_IN(X, Y, R) → U11(X, Y, R, notZero_in(Y))
REM_IN(X, Y, R) → NOTZERO_IN(Y)
U11(X, Y, R, notZero_out(Y)) → U21(X, Y, R, sub_in(X, Y, Z))
U11(X, Y, R, notZero_out(Y)) → SUB_IN(X, Y, Z)
SUB_IN(s(X), s(Y), Z) → U61(X, Y, Z, sub_in(X, Y, Z))
SUB_IN(s(X), s(Y), Z) → SUB_IN(X, Y, Z)
U21(X, Y, R, sub_out(X, Y, Z)) → U31(X, Y, R, rem_in(Z, Y, R))
U21(X, Y, R, sub_out(X, Y, Z)) → REM_IN(Z, Y, R)

The TRS R consists of the following rules:

rem_in(X, Y, X) → U4(X, Y, notZero_in(Y))
notZero_in(s(X)) → notZero_out(s(X))
U4(X, Y, notZero_out(Y)) → U5(X, Y, geq_in(X, Y))
geq_in(X, 0) → geq_out(X, 0)
geq_in(s(X), s(Y)) → U7(X, Y, geq_in(X, Y))
U7(X, Y, geq_out(X, Y)) → geq_out(s(X), s(Y))
U5(X, Y, geq_out(X, Y)) → rem_out(X, Y, X)
rem_in(X, Y, R) → U1(X, Y, R, notZero_in(Y))
U1(X, Y, R, notZero_out(Y)) → U2(X, Y, R, sub_in(X, Y, Z))
sub_in(X, 0, X) → sub_out(X, 0, X)
sub_in(s(X), s(Y), Z) → U6(X, Y, Z, sub_in(X, Y, Z))
U6(X, Y, Z, sub_out(X, Y, Z)) → sub_out(s(X), s(Y), Z)
U2(X, Y, R, sub_out(X, Y, Z)) → U3(X, Y, R, rem_in(Z, Y, R))
U3(X, Y, R, rem_out(Z, Y, R)) → rem_out(X, Y, R)

The argument filtering Pi contains the following mapping:
rem_in(x1, x2, x3)  =  rem_in(x1, x2)
U4(x1, x2, x3)  =  U4(x1, x2, x3)
notZero_in(x1)  =  notZero_in(x1)
s(x1)  =  s(x1)
notZero_out(x1)  =  notZero_out
U5(x1, x2, x3)  =  U5(x1, x3)
geq_in(x1, x2)  =  geq_in(x1, x2)
0  =  0
geq_out(x1, x2)  =  geq_out
U7(x1, x2, x3)  =  U7(x3)
rem_out(x1, x2, x3)  =  rem_out(x3)
U1(x1, x2, x3, x4)  =  U1(x1, x2, x4)
U2(x1, x2, x3, x4)  =  U2(x2, x4)
sub_in(x1, x2, x3)  =  sub_in(x1, x2)
sub_out(x1, x2, x3)  =  sub_out(x3)
U6(x1, x2, x3, x4)  =  U6(x4)
U3(x1, x2, x3, x4)  =  U3(x4)
U71(x1, x2, x3)  =  U71(x3)
U51(x1, x2, x3)  =  U51(x1, x3)
U31(x1, x2, x3, x4)  =  U31(x4)
U41(x1, x2, x3)  =  U41(x1, x2, x3)
REM_IN(x1, x2, x3)  =  REM_IN(x1, x2)
SUB_IN(x1, x2, x3)  =  SUB_IN(x1, x2)
GEQ_IN(x1, x2)  =  GEQ_IN(x1, x2)
U21(x1, x2, x3, x4)  =  U21(x2, x4)
U61(x1, x2, x3, x4)  =  U61(x4)
NOTZERO_IN(x1)  =  NOTZERO_IN(x1)
U11(x1, x2, x3, x4)  =  U11(x1, x2, x4)

We have to consider all (P,R,Pi)-chains

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
PiDP
          ↳ DependencyGraphProof

Pi DP problem:
The TRS P consists of the following rules:

REM_IN(X, Y, X) → U41(X, Y, notZero_in(Y))
REM_IN(X, Y, X) → NOTZERO_IN(Y)
U41(X, Y, notZero_out(Y)) → U51(X, Y, geq_in(X, Y))
U41(X, Y, notZero_out(Y)) → GEQ_IN(X, Y)
GEQ_IN(s(X), s(Y)) → U71(X, Y, geq_in(X, Y))
GEQ_IN(s(X), s(Y)) → GEQ_IN(X, Y)
REM_IN(X, Y, R) → U11(X, Y, R, notZero_in(Y))
REM_IN(X, Y, R) → NOTZERO_IN(Y)
U11(X, Y, R, notZero_out(Y)) → U21(X, Y, R, sub_in(X, Y, Z))
U11(X, Y, R, notZero_out(Y)) → SUB_IN(X, Y, Z)
SUB_IN(s(X), s(Y), Z) → U61(X, Y, Z, sub_in(X, Y, Z))
SUB_IN(s(X), s(Y), Z) → SUB_IN(X, Y, Z)
U21(X, Y, R, sub_out(X, Y, Z)) → U31(X, Y, R, rem_in(Z, Y, R))
U21(X, Y, R, sub_out(X, Y, Z)) → REM_IN(Z, Y, R)

The TRS R consists of the following rules:

rem_in(X, Y, X) → U4(X, Y, notZero_in(Y))
notZero_in(s(X)) → notZero_out(s(X))
U4(X, Y, notZero_out(Y)) → U5(X, Y, geq_in(X, Y))
geq_in(X, 0) → geq_out(X, 0)
geq_in(s(X), s(Y)) → U7(X, Y, geq_in(X, Y))
U7(X, Y, geq_out(X, Y)) → geq_out(s(X), s(Y))
U5(X, Y, geq_out(X, Y)) → rem_out(X, Y, X)
rem_in(X, Y, R) → U1(X, Y, R, notZero_in(Y))
U1(X, Y, R, notZero_out(Y)) → U2(X, Y, R, sub_in(X, Y, Z))
sub_in(X, 0, X) → sub_out(X, 0, X)
sub_in(s(X), s(Y), Z) → U6(X, Y, Z, sub_in(X, Y, Z))
U6(X, Y, Z, sub_out(X, Y, Z)) → sub_out(s(X), s(Y), Z)
U2(X, Y, R, sub_out(X, Y, Z)) → U3(X, Y, R, rem_in(Z, Y, R))
U3(X, Y, R, rem_out(Z, Y, R)) → rem_out(X, Y, R)

The argument filtering Pi contains the following mapping:
rem_in(x1, x2, x3)  =  rem_in(x1, x2)
U4(x1, x2, x3)  =  U4(x1, x2, x3)
notZero_in(x1)  =  notZero_in(x1)
s(x1)  =  s(x1)
notZero_out(x1)  =  notZero_out
U5(x1, x2, x3)  =  U5(x1, x3)
geq_in(x1, x2)  =  geq_in(x1, x2)
0  =  0
geq_out(x1, x2)  =  geq_out
U7(x1, x2, x3)  =  U7(x3)
rem_out(x1, x2, x3)  =  rem_out(x3)
U1(x1, x2, x3, x4)  =  U1(x1, x2, x4)
U2(x1, x2, x3, x4)  =  U2(x2, x4)
sub_in(x1, x2, x3)  =  sub_in(x1, x2)
sub_out(x1, x2, x3)  =  sub_out(x3)
U6(x1, x2, x3, x4)  =  U6(x4)
U3(x1, x2, x3, x4)  =  U3(x4)
U71(x1, x2, x3)  =  U71(x3)
U51(x1, x2, x3)  =  U51(x1, x3)
U31(x1, x2, x3, x4)  =  U31(x4)
U41(x1, x2, x3)  =  U41(x1, x2, x3)
REM_IN(x1, x2, x3)  =  REM_IN(x1, x2)
SUB_IN(x1, x2, x3)  =  SUB_IN(x1, x2)
GEQ_IN(x1, x2)  =  GEQ_IN(x1, x2)
U21(x1, x2, x3, x4)  =  U21(x2, x4)
U61(x1, x2, x3, x4)  =  U61(x4)
NOTZERO_IN(x1)  =  NOTZERO_IN(x1)
U11(x1, x2, x3, x4)  =  U11(x1, x2, x4)

We have to consider all (P,R,Pi)-chains
The approximation of the Dependency Graph [30] contains 3 SCCs with 9 less nodes.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
PiDP
                ↳ UsableRulesProof
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

SUB_IN(s(X), s(Y), Z) → SUB_IN(X, Y, Z)

The TRS R consists of the following rules:

rem_in(X, Y, X) → U4(X, Y, notZero_in(Y))
notZero_in(s(X)) → notZero_out(s(X))
U4(X, Y, notZero_out(Y)) → U5(X, Y, geq_in(X, Y))
geq_in(X, 0) → geq_out(X, 0)
geq_in(s(X), s(Y)) → U7(X, Y, geq_in(X, Y))
U7(X, Y, geq_out(X, Y)) → geq_out(s(X), s(Y))
U5(X, Y, geq_out(X, Y)) → rem_out(X, Y, X)
rem_in(X, Y, R) → U1(X, Y, R, notZero_in(Y))
U1(X, Y, R, notZero_out(Y)) → U2(X, Y, R, sub_in(X, Y, Z))
sub_in(X, 0, X) → sub_out(X, 0, X)
sub_in(s(X), s(Y), Z) → U6(X, Y, Z, sub_in(X, Y, Z))
U6(X, Y, Z, sub_out(X, Y, Z)) → sub_out(s(X), s(Y), Z)
U2(X, Y, R, sub_out(X, Y, Z)) → U3(X, Y, R, rem_in(Z, Y, R))
U3(X, Y, R, rem_out(Z, Y, R)) → rem_out(X, Y, R)

The argument filtering Pi contains the following mapping:
rem_in(x1, x2, x3)  =  rem_in(x1, x2)
U4(x1, x2, x3)  =  U4(x1, x2, x3)
notZero_in(x1)  =  notZero_in(x1)
s(x1)  =  s(x1)
notZero_out(x1)  =  notZero_out
U5(x1, x2, x3)  =  U5(x1, x3)
geq_in(x1, x2)  =  geq_in(x1, x2)
0  =  0
geq_out(x1, x2)  =  geq_out
U7(x1, x2, x3)  =  U7(x3)
rem_out(x1, x2, x3)  =  rem_out(x3)
U1(x1, x2, x3, x4)  =  U1(x1, x2, x4)
U2(x1, x2, x3, x4)  =  U2(x2, x4)
sub_in(x1, x2, x3)  =  sub_in(x1, x2)
sub_out(x1, x2, x3)  =  sub_out(x3)
U6(x1, x2, x3, x4)  =  U6(x4)
U3(x1, x2, x3, x4)  =  U3(x4)
SUB_IN(x1, x2, x3)  =  SUB_IN(x1, x2)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

SUB_IN(s(X), s(Y), Z) → SUB_IN(X, Y, Z)

R is empty.
The argument filtering Pi contains the following mapping:
s(x1)  =  s(x1)
SUB_IN(x1, x2, x3)  =  SUB_IN(x1, x2)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

SUB_IN(s(X), s(Y)) → SUB_IN(X, Y)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
PiDP
                ↳ UsableRulesProof
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

GEQ_IN(s(X), s(Y)) → GEQ_IN(X, Y)

The TRS R consists of the following rules:

rem_in(X, Y, X) → U4(X, Y, notZero_in(Y))
notZero_in(s(X)) → notZero_out(s(X))
U4(X, Y, notZero_out(Y)) → U5(X, Y, geq_in(X, Y))
geq_in(X, 0) → geq_out(X, 0)
geq_in(s(X), s(Y)) → U7(X, Y, geq_in(X, Y))
U7(X, Y, geq_out(X, Y)) → geq_out(s(X), s(Y))
U5(X, Y, geq_out(X, Y)) → rem_out(X, Y, X)
rem_in(X, Y, R) → U1(X, Y, R, notZero_in(Y))
U1(X, Y, R, notZero_out(Y)) → U2(X, Y, R, sub_in(X, Y, Z))
sub_in(X, 0, X) → sub_out(X, 0, X)
sub_in(s(X), s(Y), Z) → U6(X, Y, Z, sub_in(X, Y, Z))
U6(X, Y, Z, sub_out(X, Y, Z)) → sub_out(s(X), s(Y), Z)
U2(X, Y, R, sub_out(X, Y, Z)) → U3(X, Y, R, rem_in(Z, Y, R))
U3(X, Y, R, rem_out(Z, Y, R)) → rem_out(X, Y, R)

The argument filtering Pi contains the following mapping:
rem_in(x1, x2, x3)  =  rem_in(x1, x2)
U4(x1, x2, x3)  =  U4(x1, x2, x3)
notZero_in(x1)  =  notZero_in(x1)
s(x1)  =  s(x1)
notZero_out(x1)  =  notZero_out
U5(x1, x2, x3)  =  U5(x1, x3)
geq_in(x1, x2)  =  geq_in(x1, x2)
0  =  0
geq_out(x1, x2)  =  geq_out
U7(x1, x2, x3)  =  U7(x3)
rem_out(x1, x2, x3)  =  rem_out(x3)
U1(x1, x2, x3, x4)  =  U1(x1, x2, x4)
U2(x1, x2, x3, x4)  =  U2(x2, x4)
sub_in(x1, x2, x3)  =  sub_in(x1, x2)
sub_out(x1, x2, x3)  =  sub_out(x3)
U6(x1, x2, x3, x4)  =  U6(x4)
U3(x1, x2, x3, x4)  =  U3(x4)
GEQ_IN(x1, x2)  =  GEQ_IN(x1, x2)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

GEQ_IN(s(X), s(Y)) → GEQ_IN(X, Y)

R is empty.
Pi is empty.
We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

GEQ_IN(s(X), s(Y)) → GEQ_IN(X, Y)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
PiDP
                ↳ UsableRulesProof

Pi DP problem:
The TRS P consists of the following rules:

U21(X, Y, R, sub_out(X, Y, Z)) → REM_IN(Z, Y, R)
REM_IN(X, Y, R) → U11(X, Y, R, notZero_in(Y))
U11(X, Y, R, notZero_out(Y)) → U21(X, Y, R, sub_in(X, Y, Z))

The TRS R consists of the following rules:

rem_in(X, Y, X) → U4(X, Y, notZero_in(Y))
notZero_in(s(X)) → notZero_out(s(X))
U4(X, Y, notZero_out(Y)) → U5(X, Y, geq_in(X, Y))
geq_in(X, 0) → geq_out(X, 0)
geq_in(s(X), s(Y)) → U7(X, Y, geq_in(X, Y))
U7(X, Y, geq_out(X, Y)) → geq_out(s(X), s(Y))
U5(X, Y, geq_out(X, Y)) → rem_out(X, Y, X)
rem_in(X, Y, R) → U1(X, Y, R, notZero_in(Y))
U1(X, Y, R, notZero_out(Y)) → U2(X, Y, R, sub_in(X, Y, Z))
sub_in(X, 0, X) → sub_out(X, 0, X)
sub_in(s(X), s(Y), Z) → U6(X, Y, Z, sub_in(X, Y, Z))
U6(X, Y, Z, sub_out(X, Y, Z)) → sub_out(s(X), s(Y), Z)
U2(X, Y, R, sub_out(X, Y, Z)) → U3(X, Y, R, rem_in(Z, Y, R))
U3(X, Y, R, rem_out(Z, Y, R)) → rem_out(X, Y, R)

The argument filtering Pi contains the following mapping:
rem_in(x1, x2, x3)  =  rem_in(x1, x2)
U4(x1, x2, x3)  =  U4(x1, x2, x3)
notZero_in(x1)  =  notZero_in(x1)
s(x1)  =  s(x1)
notZero_out(x1)  =  notZero_out
U5(x1, x2, x3)  =  U5(x1, x3)
geq_in(x1, x2)  =  geq_in(x1, x2)
0  =  0
geq_out(x1, x2)  =  geq_out
U7(x1, x2, x3)  =  U7(x3)
rem_out(x1, x2, x3)  =  rem_out(x3)
U1(x1, x2, x3, x4)  =  U1(x1, x2, x4)
U2(x1, x2, x3, x4)  =  U2(x2, x4)
sub_in(x1, x2, x3)  =  sub_in(x1, x2)
sub_out(x1, x2, x3)  =  sub_out(x3)
U6(x1, x2, x3, x4)  =  U6(x4)
U3(x1, x2, x3, x4)  =  U3(x4)
REM_IN(x1, x2, x3)  =  REM_IN(x1, x2)
U21(x1, x2, x3, x4)  =  U21(x2, x4)
U11(x1, x2, x3, x4)  =  U11(x1, x2, x4)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof

Pi DP problem:
The TRS P consists of the following rules:

U21(X, Y, R, sub_out(X, Y, Z)) → REM_IN(Z, Y, R)
REM_IN(X, Y, R) → U11(X, Y, R, notZero_in(Y))
U11(X, Y, R, notZero_out(Y)) → U21(X, Y, R, sub_in(X, Y, Z))

The TRS R consists of the following rules:

notZero_in(s(X)) → notZero_out(s(X))
sub_in(X, 0, X) → sub_out(X, 0, X)
sub_in(s(X), s(Y), Z) → U6(X, Y, Z, sub_in(X, Y, Z))
U6(X, Y, Z, sub_out(X, Y, Z)) → sub_out(s(X), s(Y), Z)

The argument filtering Pi contains the following mapping:
notZero_in(x1)  =  notZero_in(x1)
s(x1)  =  s(x1)
notZero_out(x1)  =  notZero_out
0  =  0
sub_in(x1, x2, x3)  =  sub_in(x1, x2)
sub_out(x1, x2, x3)  =  sub_out(x3)
U6(x1, x2, x3, x4)  =  U6(x4)
REM_IN(x1, x2, x3)  =  REM_IN(x1, x2)
U21(x1, x2, x3, x4)  =  U21(x2, x4)
U11(x1, x2, x3, x4)  =  U11(x1, x2, x4)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ Narrowing

Q DP problem:
The TRS P consists of the following rules:

REM_IN(X, Y) → U11(X, Y, notZero_in(Y))
U21(Y, sub_out(Z)) → REM_IN(Z, Y)
U11(X, Y, notZero_out) → U21(Y, sub_in(X, Y))

The TRS R consists of the following rules:

notZero_in(s(X)) → notZero_out
sub_in(X, 0) → sub_out(X)
sub_in(s(X), s(Y)) → U6(sub_in(X, Y))
U6(sub_out(Z)) → sub_out(Z)

The set Q consists of the following terms:

notZero_in(x0)
sub_in(x0, x1)
U6(x0)

We have to consider all (P,Q,R)-chains.
By narrowing [15] the rule REM_IN(X, Y) → U11(X, Y, notZero_in(Y)) at position [2] we obtained the following new rules:

REM_IN(y0, s(x0)) → U11(y0, s(x0), notZero_out)



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
                      ↳ QDP
                        ↳ Narrowing
QDP
                            ↳ UsableRulesProof

Q DP problem:
The TRS P consists of the following rules:

REM_IN(y0, s(x0)) → U11(y0, s(x0), notZero_out)
U21(Y, sub_out(Z)) → REM_IN(Z, Y)
U11(X, Y, notZero_out) → U21(Y, sub_in(X, Y))

The TRS R consists of the following rules:

notZero_in(s(X)) → notZero_out
sub_in(X, 0) → sub_out(X)
sub_in(s(X), s(Y)) → U6(sub_in(X, Y))
U6(sub_out(Z)) → sub_out(Z)

The set Q consists of the following terms:

notZero_in(x0)
sub_in(x0, x1)
U6(x0)

We have to consider all (P,Q,R)-chains.
As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [15] we can delete all non-usable rules [17] from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
                      ↳ QDP
                        ↳ Narrowing
                          ↳ QDP
                            ↳ UsableRulesProof
QDP
                                ↳ QReductionProof

Q DP problem:
The TRS P consists of the following rules:

REM_IN(y0, s(x0)) → U11(y0, s(x0), notZero_out)
U21(Y, sub_out(Z)) → REM_IN(Z, Y)
U11(X, Y, notZero_out) → U21(Y, sub_in(X, Y))

The TRS R consists of the following rules:

sub_in(X, 0) → sub_out(X)
sub_in(s(X), s(Y)) → U6(sub_in(X, Y))
U6(sub_out(Z)) → sub_out(Z)

The set Q consists of the following terms:

notZero_in(x0)
sub_in(x0, x1)
U6(x0)

We have to consider all (P,Q,R)-chains.
We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.

notZero_in(x0)



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
                      ↳ QDP
                        ↳ Narrowing
                          ↳ QDP
                            ↳ UsableRulesProof
                              ↳ QDP
                                ↳ QReductionProof
QDP
                                    ↳ Narrowing

Q DP problem:
The TRS P consists of the following rules:

REM_IN(y0, s(x0)) → U11(y0, s(x0), notZero_out)
U21(Y, sub_out(Z)) → REM_IN(Z, Y)
U11(X, Y, notZero_out) → U21(Y, sub_in(X, Y))

The TRS R consists of the following rules:

sub_in(X, 0) → sub_out(X)
sub_in(s(X), s(Y)) → U6(sub_in(X, Y))
U6(sub_out(Z)) → sub_out(Z)

The set Q consists of the following terms:

sub_in(x0, x1)
U6(x0)

We have to consider all (P,Q,R)-chains.
By narrowing [15] the rule U11(X, Y, notZero_out) → U21(Y, sub_in(X, Y)) at position [1] we obtained the following new rules:

U11(s(x0), s(x1), notZero_out) → U21(s(x1), U6(sub_in(x0, x1)))
U11(x0, 0, notZero_out) → U21(0, sub_out(x0))



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
                      ↳ QDP
                        ↳ Narrowing
                          ↳ QDP
                            ↳ UsableRulesProof
                              ↳ QDP
                                ↳ QReductionProof
                                  ↳ QDP
                                    ↳ Narrowing
QDP
                                        ↳ DependencyGraphProof

Q DP problem:
The TRS P consists of the following rules:

REM_IN(y0, s(x0)) → U11(y0, s(x0), notZero_out)
U11(s(x0), s(x1), notZero_out) → U21(s(x1), U6(sub_in(x0, x1)))
U11(x0, 0, notZero_out) → U21(0, sub_out(x0))
U21(Y, sub_out(Z)) → REM_IN(Z, Y)

The TRS R consists of the following rules:

sub_in(X, 0) → sub_out(X)
sub_in(s(X), s(Y)) → U6(sub_in(X, Y))
U6(sub_out(Z)) → sub_out(Z)

The set Q consists of the following terms:

sub_in(x0, x1)
U6(x0)

We have to consider all (P,Q,R)-chains.
The approximation of the Dependency Graph [15,17,22] contains 1 SCC with 1 less node.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
                      ↳ QDP
                        ↳ Narrowing
                          ↳ QDP
                            ↳ UsableRulesProof
                              ↳ QDP
                                ↳ QReductionProof
                                  ↳ QDP
                                    ↳ Narrowing
                                      ↳ QDP
                                        ↳ DependencyGraphProof
QDP
                                            ↳ Instantiation

Q DP problem:
The TRS P consists of the following rules:

REM_IN(y0, s(x0)) → U11(y0, s(x0), notZero_out)
U11(s(x0), s(x1), notZero_out) → U21(s(x1), U6(sub_in(x0, x1)))
U21(Y, sub_out(Z)) → REM_IN(Z, Y)

The TRS R consists of the following rules:

sub_in(X, 0) → sub_out(X)
sub_in(s(X), s(Y)) → U6(sub_in(X, Y))
U6(sub_out(Z)) → sub_out(Z)

The set Q consists of the following terms:

sub_in(x0, x1)
U6(x0)

We have to consider all (P,Q,R)-chains.
By instantiating [15] the rule U21(Y, sub_out(Z)) → REM_IN(Z, Y) we obtained the following new rules:

U21(s(z1), sub_out(x1)) → REM_IN(x1, s(z1))



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
                      ↳ QDP
                        ↳ Narrowing
                          ↳ QDP
                            ↳ UsableRulesProof
                              ↳ QDP
                                ↳ QReductionProof
                                  ↳ QDP
                                    ↳ Narrowing
                                      ↳ QDP
                                        ↳ DependencyGraphProof
                                          ↳ QDP
                                            ↳ Instantiation
QDP
                                                ↳ ForwardInstantiation

Q DP problem:
The TRS P consists of the following rules:

REM_IN(y0, s(x0)) → U11(y0, s(x0), notZero_out)
U21(s(z1), sub_out(x1)) → REM_IN(x1, s(z1))
U11(s(x0), s(x1), notZero_out) → U21(s(x1), U6(sub_in(x0, x1)))

The TRS R consists of the following rules:

sub_in(X, 0) → sub_out(X)
sub_in(s(X), s(Y)) → U6(sub_in(X, Y))
U6(sub_out(Z)) → sub_out(Z)

The set Q consists of the following terms:

sub_in(x0, x1)
U6(x0)

We have to consider all (P,Q,R)-chains.
By forward instantiating [14] the rule REM_IN(y0, s(x0)) → U11(y0, s(x0), notZero_out) we obtained the following new rules:

REM_IN(s(y_0), s(x1)) → U11(s(y_0), s(x1), notZero_out)



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
                      ↳ QDP
                        ↳ Narrowing
                          ↳ QDP
                            ↳ UsableRulesProof
                              ↳ QDP
                                ↳ QReductionProof
                                  ↳ QDP
                                    ↳ Narrowing
                                      ↳ QDP
                                        ↳ DependencyGraphProof
                                          ↳ QDP
                                            ↳ Instantiation
                                              ↳ QDP
                                                ↳ ForwardInstantiation
QDP
                                                    ↳ ForwardInstantiation

Q DP problem:
The TRS P consists of the following rules:

U11(s(x0), s(x1), notZero_out) → U21(s(x1), U6(sub_in(x0, x1)))
U21(s(z1), sub_out(x1)) → REM_IN(x1, s(z1))
REM_IN(s(y_0), s(x1)) → U11(s(y_0), s(x1), notZero_out)

The TRS R consists of the following rules:

sub_in(X, 0) → sub_out(X)
sub_in(s(X), s(Y)) → U6(sub_in(X, Y))
U6(sub_out(Z)) → sub_out(Z)

The set Q consists of the following terms:

sub_in(x0, x1)
U6(x0)

We have to consider all (P,Q,R)-chains.
By forward instantiating [14] the rule U21(s(z1), sub_out(x1)) → REM_IN(x1, s(z1)) we obtained the following new rules:

U21(s(x0), sub_out(s(y_0))) → REM_IN(s(y_0), s(x0))



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
                      ↳ QDP
                        ↳ Narrowing
                          ↳ QDP
                            ↳ UsableRulesProof
                              ↳ QDP
                                ↳ QReductionProof
                                  ↳ QDP
                                    ↳ Narrowing
                                      ↳ QDP
                                        ↳ DependencyGraphProof
                                          ↳ QDP
                                            ↳ Instantiation
                                              ↳ QDP
                                                ↳ ForwardInstantiation
                                                  ↳ QDP
                                                    ↳ ForwardInstantiation
QDP
                                                        ↳ QDPOrderProof

Q DP problem:
The TRS P consists of the following rules:

U21(s(x0), sub_out(s(y_0))) → REM_IN(s(y_0), s(x0))
U11(s(x0), s(x1), notZero_out) → U21(s(x1), U6(sub_in(x0, x1)))
REM_IN(s(y_0), s(x1)) → U11(s(y_0), s(x1), notZero_out)

The TRS R consists of the following rules:

sub_in(X, 0) → sub_out(X)
sub_in(s(X), s(Y)) → U6(sub_in(X, Y))
U6(sub_out(Z)) → sub_out(Z)

The set Q consists of the following terms:

sub_in(x0, x1)
U6(x0)

We have to consider all (P,Q,R)-chains.
We use the reduction pair processor [15].


The following pairs can be oriented strictly and are deleted.


U11(s(x0), s(x1), notZero_out) → U21(s(x1), U6(sub_in(x0, x1)))
The remaining pairs can at least be oriented weakly.

U21(s(x0), sub_out(s(y_0))) → REM_IN(s(y_0), s(x0))
REM_IN(s(y_0), s(x1)) → U11(s(y_0), s(x1), notZero_out)
Used ordering: Polynomial interpretation [25]:

POL(0) = 0   
POL(REM_IN(x1, x2)) = x1   
POL(U11(x1, x2, x3)) = x1   
POL(U21(x1, x2)) = x2   
POL(U6(x1)) = x1   
POL(notZero_out) = 0   
POL(s(x1)) = 1 + x1   
POL(sub_in(x1, x2)) = x1   
POL(sub_out(x1)) = x1   

The following usable rules [17] were oriented:

sub_in(s(X), s(Y)) → U6(sub_in(X, Y))
sub_in(X, 0) → sub_out(X)
U6(sub_out(Z)) → sub_out(Z)



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
                      ↳ QDP
                        ↳ Narrowing
                          ↳ QDP
                            ↳ UsableRulesProof
                              ↳ QDP
                                ↳ QReductionProof
                                  ↳ QDP
                                    ↳ Narrowing
                                      ↳ QDP
                                        ↳ DependencyGraphProof
                                          ↳ QDP
                                            ↳ Instantiation
                                              ↳ QDP
                                                ↳ ForwardInstantiation
                                                  ↳ QDP
                                                    ↳ ForwardInstantiation
                                                      ↳ QDP
                                                        ↳ QDPOrderProof
QDP
                                                            ↳ DependencyGraphProof

Q DP problem:
The TRS P consists of the following rules:

U21(s(x0), sub_out(s(y_0))) → REM_IN(s(y_0), s(x0))
REM_IN(s(y_0), s(x1)) → U11(s(y_0), s(x1), notZero_out)

The TRS R consists of the following rules:

sub_in(X, 0) → sub_out(X)
sub_in(s(X), s(Y)) → U6(sub_in(X, Y))
U6(sub_out(Z)) → sub_out(Z)

The set Q consists of the following terms:

sub_in(x0, x1)
U6(x0)

We have to consider all (P,Q,R)-chains.
The approximation of the Dependency Graph [15,17,22] contains 0 SCCs with 2 less nodes.